package bean;

import util.KMeans;

import java.util.ArrayList;
import java.util.Map;

public class AllBean {
	SelectBean sb = new SelectBean();
	ArrayList al = null;
	KMeans kMeans=new KMeans();

	public Map<Integer, ArrayList> getKMeans(){
		return  kMeans.calc();
	}

	
	public ArrayList getDandu(String id){
		String sql = "select * from dandu where id="+id;
		String args[] = {"id","content"};
		al = sb.select(args, sql);
		return al;
	}
	
	public ArrayList getUser(){
		String sql = "select * from users order by id desc";
		String args[] = {"id","name","pwd","reallyname","sex","qq","idcard","email","phone","address","postcode"};
		al = sb.select(sql, args);
		return al;
	}
	
	public ArrayList getUser(String id){
		String sql = "select * from users where id="+id;
		String args[] = {"id","name","pwd","reallyname","sex","qq","idcard","email","phone","address","postcode"};
		al = sb.select(args, sql);
		return al;
	}
	
	public ArrayList getFeiji(){
		String sql = "select * from feiji order by id desc";
		String args[] = {"id","banci","gongsi","qifeichengshi","qifeijichang","qifeitime","daodachengshi","daodajichang","daodatime","jingji","jingjisums","toudeng","toudengsums","beizhu"};
		al = sb.select(sql, args);
		return al;
	}
	
	public ArrayList getFeiji(String id){
		String sql = "select * from feiji where id="+id;
		String args[] = {"id","banci","gongsi","qifeichengshi","qifeijichang","qifeitime","daodachengshi","daodajichang","daodatime","jingji","jingjisums","toudeng","toudengsums","beizhu"};
		al = sb.select(args, sql);
		return al;
	}
	
	public ArrayList getFeijiHangban(String hangban){
		String sql = "select * from feiji where banci like '%"+hangban+"%' order by id desc";
		String args[] = {"id","banci","gongsi","qifeichengshi","qifeijichang","qifeitime","daodachengshi","daodajichang","daodatime","jingji","jingjisums","toudeng","toudengsums","beizhu"};
		al = sb.select(sql, args);
		return al;
	}
	
	public ArrayList getFeijiQifei(String qifei){
		String sql = "select * from feiji where qifeichengshi like '%"+qifei+"%' order by id desc";
		String args[] = {"id","banci","gongsi","qifeichengshi","qifeijichang","qifeitime","daodachengshi","daodajichang","daodatime","jingji","jingjisums","toudeng","toudengsums","beizhu"};
		al = sb.select(sql, args);
		return al;
	}
	
	public ArrayList getFeijiDaoda(String daoda){
		String sql = "select * from feiji where daodachengshi like '%"+daoda+"%' order by id desc";
		String args[] = {"id","banci","gongsi","qifeichengshi","qifeijichang","qifeitime","daodachengshi","daodajichang","daodatime","jingji","jingjisums","toudeng","toudengsums","beizhu"};
		al = sb.select(sql, args);
		return al;
	}
	
	public ArrayList getYudingji(){
		String sql = "select * from yudingji order by id desc";
		String args[] = {"id","usersid","feijiid","zuoxi","price","sums","zongjia","times","zhifu"};
		al = sb.select(sql, args);
		return al;
	}
	
	public ArrayList getYudingji(String id){
		String sql = "select * from yudingji where id="+id;
		String args[] = {"id","usersid","feijiid","zuoxi","price","sums","zongjia","times","zhifu"};
		al = sb.select(args, sql);
		return al;
	}
	
	public ArrayList getYudingjiUser(String usersid){
		String sql = "select * from yudingji where usersid="+usersid+" order by id desc";
		String args[] = {"id","usersid","feijiid","zuoxi","price","sums","zongjia","times","zhifu"};
		al = sb.select(sql, args);
		return al;
	}
}
